#include <string>
#include <iostream>
#include <list>
#include <map>
#include <cstdio>
#include <fstream>
#include <sstream>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <errno.h>

extern "C"{
#include <assert.h>
#include <sys/time.h>
}
#ifdef _WIN32
#include <stdint.h>	//uint8_t
//typedef unsigned int ssize_t;
#else
#endif

using namespace std;

#define MAX_LINE_LENGTH 128
#define LINE_LENGTH_64 64
#define LINE_LENGTH_32 32
#define LINE_LENGTH_16 16
#define MIN_LINE_LENGTH 8

#define SUCCESS 1
#define FAILURE 0
#define ERROR -1
/*
typedef struct userInfo{
	string userName;
	FILE* sidFile;
	string userIp;
}UserInfo;
*/

#define MAX_AREA_RISK 7

uint32_t StrDec2Int(string& strDec)
{
	stringstream _z;
	uint32_t ret = 0;
	_z << strDec;
	try {
		_z >> ret;
	}
	catch(...) {

	}
	return ret;
}

string Int2StrDec(uint32_t num)
{
	stringstream _z;
	string ret;
	_z << num;
	try {
		_z >> ret;
	}
	catch(...) {

	}
	return ret;
}

uint32_t mask[MAX_AREA_RISK] = {0xc0000000,0xfe000000,0xfff00000,
0xffff8000,0xfffffc00,0xffffffe0,0xffffffff};

int main()
{
    //string s = "3329569283";
    string s = "3329568768";
    uint32_t sAsInt = StrDec2Int(s);
	int i;
	for(i = 0; i < MAX_AREA_RISK; i++) {
		uint32_t result = sAsInt & mask[i];
		if(result == sAsInt) {
			cout << "This is a " << i << " risk area." << endl;
			break;
		}
	}

	string a = "";
	cout << "___" << StrDec2Int(a) << "____" << endl;

    return 0;
}
